//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a RdGen v1.07.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Linq;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using JetBrains.Annotations;

using JetBrains.Core;
using JetBrains.Diagnostics;
using JetBrains.Collections;
using JetBrains.Collections.Viewable;
using JetBrains.Lifetimes;
using JetBrains.Serialization;
using JetBrains.Rd;
using JetBrains.Rd.Base;
using JetBrains.Rd.Impl;
using JetBrains.Rd.Tasks;
using JetBrains.Rd.Util;
using JetBrains.Rd.Text;


// ReSharper disable RedundantEmptyObjectCreationArgumentList
// ReSharper disable InconsistentNaming
// ReSharper disable RedundantOverflowCheckingContext


namespace InheritsAutomationRoot
{
  
  
  /// <summary>
  /// <p>Generated from: InheritsAutomationTest.kt:18</p>
  /// </summary>
  public class InheritsAutomationExtension : RdExtBase
  {
    //fields
    //public fields
    
    //private fields
    //primary constructor
    private InheritsAutomationExtension(
    )
    {
    }
    //secondary constructor
    //deconstruct trait
    //statics
    
    
    
    protected override long SerializationHash => -7010073710305884329L;
    
    protected override Action<ISerializers> Register => RegisterDeclaredTypesSerializers;
    public static void RegisterDeclaredTypesSerializers(ISerializers serializers)
    {
      serializers.Register(TestModel_Unknown.Read, TestModel_Unknown.Write);
      
      serializers.RegisterToplevelOnce(typeof(InheritsAutomationRoot), InheritsAutomationRoot.RegisterDeclaredTypesSerializers);
    }
    
    public InheritsAutomationExtension(Lifetime lifetime, IProtocol protocol) : this()
    {
      Identify(protocol.Identities, RdId.Root.Mix("InheritsAutomationExtension"));
      Bind(lifetime, protocol, "InheritsAutomationExtension");
    }
    
    //constants
    
    //custom body
    //methods
    //equals trait
    //hash code trait
    //pretty print
    public override void Print(PrettyPrinter printer)
    {
      printer.Println("InheritsAutomationExtension (");
      printer.Print(")");
    }
    //toString
    public override string ToString()
    {
      var printer = new SingleLinePrettyPrinter();
      Print(printer);
      return printer.ToString();
    }
  }
  
  
  /// <summary>
  /// <p>Generated from: InheritsAutomationTest.kt:19</p>
  /// </summary>
  public abstract class TestModel : RdBindableBase, JetBrains.Application.UI.UIAutomation.IAutomation
  {
    //fields
    //public fields
    
    //private fields
    //primary constructor
    //secondary constructor
    //deconstruct trait
    //statics
    
    public static CtxReadDelegate<TestModel> Read = Polymorphic<TestModel>.ReadAbstract(TestModel_Unknown.Read);
    
    public static CtxWriteDelegate<TestModel> Write = Polymorphic<TestModel>.Write;
    
    //constants
    
    //custom body
    public override event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
    //methods
    //equals trait
    //hash code trait
    //pretty print
    //toString
  }
  
  
  public sealed class TestModel_Unknown : TestModel
  {
    //fields
    //public fields
    
    //private fields
    //primary constructor
    //secondary constructor
    //deconstruct trait
    //statics
    
    public static new CtxReadDelegate<TestModel_Unknown> Read = (ctx, reader) => 
    {
      var _id = RdId.Read(reader);
      var _result = new TestModel_Unknown().WithId(_id);
      return _result;
    };
    
    public static new CtxWriteDelegate<TestModel_Unknown> Write = (ctx, writer, value) => 
    {
      value.RdId.Write(writer);
    };
    
    //constants
    
    //custom body
    //methods
    //equals trait
    //hash code trait
    //pretty print
    public override void Print(PrettyPrinter printer)
    {
      printer.Println("TestModel_Unknown (");
      printer.Print(")");
    }
    //toString
    public override string ToString()
    {
      var printer = new SingleLinePrettyPrinter();
      Print(printer);
      return printer.ToString();
    }
  }
}
